package com.hnichr.crm.common.receipt.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 收款单管理 crm_receipt
 *
 * @author Cheng
 * @date 2022-12-24
 */
@Data
@Entity
@Table(name = "crm_receipt")
@Schema(description = "收款单管理")
@EqualsAndHashCode(callSuper = false)
public class CrmReceipt extends BaseEntity {

    /**
     * id
     */
    @Id
    @Generator
    @Schema(description = "id")
    @Column(name = "id", length = 64)
    private String id;
    /**
     * 收款单编号
     */
    @Schema(description = "收款单编号")
    @Column(name = "num", length = 64)
    private String num;
    /**
     * 收款方式
     */
    @Dict(dicCode = "pay_type")
    @Schema(description = "收款方式")
    @Column(name = "pay_type", length = 16)
    private String payType;
    /**
     * 客户ID
     */
    @Schema(description = "客户ID")
    @Column(name = "customer_id", length = 64)
    private String customerId;
    /**
     * 客户名称
     */
    @Schema(description = "客户名称")
    @Column(name = "customer_name", length = 255)
    private String customerName;
    /**
     * 客户归属人
     */
    @Schema(description = "客户归属人")
    @Column(name = "belong_to")
    private String belongTo;
    /**
     * 客户所有人
     */
    @Schema(description = "客户所有人")
    @Column(name = "owner_customer", length = 64)
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String ownerCustomer;
    /**
     * 合同
     */
    @Schema(description = "合同")
    @Column(name = "contract_id")
    private String contractId;
    /**
     * 合同名称
     */
    @Schema(description = "合同编号")
    @Column(name = "contract_num")
    private String contractNum;
    /**
     * 合同名称
     */
    @Schema(description = "合同名称")
    @Column(name = "contract_name")
    private String contractName;
    /**
     * 收款时间
     */
    @Schema(description = "收款时间")
    @Column(name = "pay_time")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date payTime;
    /**
     * 收款金额
     */
    @Schema(description = "收款金额")
    @Column(name = "receipt_money")
    private BigDecimal receiptMoney;
    /**
     * 所属公司
     */
    @Schema(description = "所属公司")
    @Column(name = "remark")
    private String company;

}
